package eu.dominicum.ft.pd;

import eu.dominicum.ft.pd.mao.MakeLocationMAO;

/**
 * Location.
 *
 * @author Harry Klerks
 * @since 2013M1
 */
public class Location extends PersistentDomainObject {

    /**
     * Location name.
     */
    private String name;

    /**
     * Location's country.
     */
    private Country country;

    /**
     * Make a Location object.
     *
     * @param makeLocationMAO -
     * @return Location
     */
    protected static Location make(final MakeLocationMAO makeLocationMAO) {

        Location newLocation = new Location();

        newLocation.name = makeLocationMAO.getName();
        if (makeLocationMAO.getCountry() == null) {
            newLocation.country = Country.make(makeLocationMAO.getMakeCountryMAO());
        } else {
            newLocation.country = makeLocationMAO.getCountry();
        }

        return newLocation;
    }

    /**
     * Protected constructor to satisfy JPA based object stores.
     */
    protected Location() {

    }

    /**
     * .
     *
     * @return String
     */
    public final String getName() {
        return name;
    }

    /**
     * .
     *
     * @return Country
     */
    public final Country getCountry() {
        return country;
    }
}
